package com.hardy.leetcode;

/**
 * User: Ruijie Date: 2016/9/9
 */
public class ValidNumber {

    public static boolean isNumber(String s) {
        if (s == null || s.length() == 0) {
            return false;
        }
        if(s.length()==1){
            if(s.charAt(0)<'0'||s.charAt(0)>'9'){
                return false;
            }else{
                return true;
            }
        }
        
        return true;
    }

    public static void main(String[] args) {
        System.out.println(isNumber("  1")+"----------true");
        System.out.println(isNumber("1  4")+"----------false");
        System.out.println(isNumber("1     ")+"-----------true");
      /*  System.out.println(isNumber("1  ")+"--------true");
        System.out.println(isNumber("0..")+"--------false");
        System.out.println(isNumber("1 4")+"----------false");
        System.out.println(isNumber("01")+"--------------true");
        System.out.println(isNumber(".")+"---------false");
        System.out.println(isNumber("e")+"----------------false");
        System.out.println(isNumber(" .")+"-----------false");
        System.out.println(isNumber(" 12")+"---------------true");
        System.out.println(isNumber(".1")+"----------true");
        System.out.println(isNumber("0")+"------------true");
        System.out.println(isNumber("1 ")+"------------true");
        System.out.println(isNumber("0.1")+"------------true");
        System.out.println(isNumber("2e")+"-----------false");
        System.out.println(isNumber("2e4")+"----------true");
        System.out.println(isNumber("ad")+"-----------false");
        System.out.println(isNumber("0.")+"-----------true");
        System.out.println(isNumber("123d")+"-----------false");
        System.out.println(isNumber("12312")+"----------true");
        System.out.println(isNumber("1.")+"-------------true");*/
    }
}
